package com.hngy.educationaladministration.service.serviceImpl;

import com.hngy.educationaladministration.entity.Classes;
import com.hngy.educationaladministration.mapper.ClassesMapper;
import com.hngy.educationaladministration.service.ClassesService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * @author Deng JunHao
 * @date 2021/04/09 15:49
 * @description：crud
 **/
@Service
public class ClassesServicelmpl implements ClassesService {
    @Autowired
    private ClassesMapper classesMapper;

    @Override
    public List<Classes> selectById(Classes classes) {
        return classesMapper.selectById(classes.getId());
    }

    @Override
    public long insertById(Classes classes) {
        return classesMapper.insertById(classes);
    }

    @Override
    public long deleteById(Classes classes) {
        return classesMapper.deleteById(classes.getId());
    }

    @Override
    public long updateById(Classes classes) {
        return classesMapper.updateById(classes);
    }

//    @Override
//    public List<Classes> getClasses(Integer offset, String getName) {
//        // 设置分页查询条件
//        MyClassExample myClassExample = new MyClassExample();
//        //  添加查询条件
//        myClassExample = addCondition(myClassExample,offset,getName);
//
//        if(myClassExample==null) {
//            return null;
//        }
//
//        //如果 offset 为 -1 则只查询 id 和 name 列
//        if(offset==-1)
//        {
//            return myClassMapper.selectByExampleSelective(myClassExample,
//                    MyClass.Column.id,
//                    MyClass.Column.className);
//        }else{
//            return myClassMapper.selectByExampleSelective(myClassExample);
//        }
//
//    }
}
